package hihocoder;
import java.util.Arrays;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class 偶像的条件 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int N=scanner.nextInt();
		int M=scanner.nextInt();
		int L=scanner.nextInt();
		int A[]=new int[N];
		int B[]=new int[M];
		int C[]=new int[L];
		for(int i=0;i<N;i++){
			A[i]=scanner.nextInt();
		}
		for(int i=0;i<M;i++){
			B[i]=scanner.nextInt();
		}
		for(int i=0;i<L;i++){
			C[i]=scanner.nextInt();
		}
		Arrays.sort(A);
		Arrays.sort(B);
		Arrays.sort(C);
		int i=0,j=0,k=0;
		int D=Integer.MAX_VALUE;
		while (i!=N-1&&j!=M-1&&k!=L-1) {
			int tmpD=Math.abs(A[i]-B[j])+Math.abs(B[j]-C[k])+Math.abs(C[k]-A[i]);
			if(tmpD<D){
				D=tmpD;
			}
			if(i!=N-1&&A[i]<=B[j]&&A[i]<=C[k]){
				i++;
			}else if (j!=M-1&&B[j]<=A[i]&&B[j]<=C[k]) {
				j++;
			}else if(k!=L-1){
				k++;
			}
		}
		System.out.println(D);
	}

}
